package cate.game.play.buff.h;

import cate.game.play.buff.BuffHandler;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.proce.action.ctx.ActionCtx;
import cate.game.play.proce.action.ctx.SkillActionCtx;
import cate.game.play.proce.action.ctx.TimeActionCtx;
import cate.game.play.proce.move.MoveCtx;
import cate.game.play.skill.Skill;
import cate.game.play.skill.effect.SkillEffect;

/**
 * 此状态下【索命鱼叉】无冷却且附加诅咒的概率提升10%)，
 */
public class 海神护体BH extends BuffHandler {

	private int 技能原型;

	private int 提升概率;

	//技能原型=？？&提升概率=1000
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		技能原型 = args.getInt("技能原型", 0);
		提升概率 = args.getInt("提升概率", 0);
	}

	@Override
	public void onAdd(ActionCtx action) {
		Skill skill = buff.owner.skill.getActiveSkillByProtoId(技能原型);
		if (skill != null) {
			buff.owner.cd.refresh(skill.tid);
		}
	}

	@Override
	public void onOwnerMoveDone(MoveCtx move, TimeActionCtx action) {
		if (move.getSkill().cfg.row.protoId == 技能原型) {
			buff.owner.cd.refresh(move.getSkill().tid);
		}
	}

	@Override
	public void afterSelectTargets(SkillActionCtx action, SkillEffect effect) {
		if (action.getSkill().cfg.row.protoId == 技能原型) {
			effect.addExBuffChance(提升概率);
		}
	}
}
